#include "types.h"

#ifndef _MAIN_H
#define _MAIN_H
/*=================================================================*/
#define F_CPU 12000000UL
/*/--------------------------- defines */

#define APPNAME		"AVRWebRadio"
#define APPVER		"0.1.0"

/* ENC28J60 */
#define	ENC28J60_DISABLE()	PORTB |= B4
#define ENC28J60_ENABLE()	PORTB &= ~B4

/* VS1053 */
#define	VS_DREQ_CHECK()		( PIND & B2 ) /* 1 - can accept data */
#define	VS_RST_DISABLE()	PORTB |= B3
#define VS_RST_ENABLE()		PORTB &= ~B3
#define VS_xCS_DISABLE()	PORTB |= B1
#define VS_xCS_ENABLE()		PORTB &= ~B1
#define	VS_xDCS_ENABLE()	PORTB |= B0
#define VS_xDCS_DISABLE()	PORTB |= ~B0

/* EEPROM */
#define EEPROM1_ENABLE()	PORTD &= ~B0
#define EEPROM1_DISABLE()	PORTD |= B0
#define EEPROM2_ENABLE()	PORTD &= ~B1
#define EEPROM2_DISABLE()	PORTD |= B1

/* LCD */
#define LCD_RS_COMMAND()	PORTC &= ~B6
#define LCD_RS_DATA()		PORTC |= B6
#define LCD_RW_READ()		PORTC |= B5
#define LCD_RW_WRITE()		PORTC &= ~B5
#define LCD_ENABLE()		PORTC |= B4
#define LCD_DISABLE()		PORTC |= ~B4
#define LCD_DATA_PORT		PORTC

/* buttons */
#define	BUTT_PRESSED()		( PIND & B3 )
#define BUTT_UP()		( PIND & B4 )
#define BUTT_DOWN()		( PIND & B5 )
#define BUTT_OK()		( PIND & B6 )

/* LED */
#define LED_ON()			( PORTD &= ~B7 )
#define LED_OFF()			( PORTD |= B7 )

UINT32	get_acttime(void);

#endif